package cn.cvs.service.admin;

import cn.cvs.dao.admin.AdminsMapper;
import cn.cvs.pojo.Admin;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AdminServiceImpl implements AdminService{

    @Resource
    private AdminsMapper adminMapper;

    @Override
    public Admin selectByNameAndPwd(String name, String pwd) {
        return adminMapper.selectByNameAndPwd(name, pwd);
    }

    @Override
    public List<Admin> list(String name, Integer pageIndex, Integer pageSize) {
        int pageBean = (pageIndex - 1) * pageSize;
        return adminMapper.list(name, pageBean, pageSize);
    }

    @Override
    public int count(String name) {
        return adminMapper.selectCount(name);
    }

    @Override
    public int insert(Admin admin) {
        return adminMapper.insert(admin);
    }

    @Override
    public int updateById(Admin admin) {
        return adminMapper.updateById(admin);
    }

    @Override
    public int deleteById(Integer id) {
        return adminMapper.deleteById(id);
    }

    @Override
    public Admin selectById(Integer id) {
        return adminMapper.selectById(id);
    }
}
